package org.example;

import cn.hserver.core.ioc.annotation.Bean;
import cn.hserver.plugin.gateway.business.BusinessHttp7;
import cn.hserver.plugin.gateway.business.BusinessTcp;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;

import java.net.InetSocketAddress;
import java.net.SocketAddress;

@Bean
public class MyBusinessTcp extends BusinessTcp {
    @Override
    public SocketAddress getProxyHost(ChannelHandlerContext ctx, Object o, SocketAddress sourceSocketAddress) {
        return new InetSocketAddress("127.0.0.1",8888);
    }

    @Override
    public Object in(ChannelHandlerContext ctx, Object obj) {
        return super.in(ctx, obj);
    }

    @Override
    public Object out(Channel channel, Object obj) {
        return super.out(channel, obj);
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
        cause.printStackTrace();
    }
}
